package com.yxhl.zoume.data.http.rest;

import com.yxhl.protobuf.BizOrderRequest;
import com.yxhl.protobuf.BizOrderResponse;
import com.yxhl.protobuf.IsFerryRequest;
import com.yxhl.protobuf.IsFerryResponse;
import com.yxhl.protobuf.MpvModelRequest;
import com.yxhl.protobuf.MpvModelResponse;
import com.yxhl.protobuf.OneYxBusInfoRequest;
import com.yxhl.protobuf.OneYxBusInfoResponse;
import com.yxhl.protobuf.PubEndStationRequest;
import com.yxhl.protobuf.PubEndStationResponse;
import com.yxhl.protobuf.PubLockTicketRequest;
import com.yxhl.protobuf.PubLockTicketResponse;
import com.yxhl.protobuf.PubStartCityRequest;
import com.yxhl.protobuf.PubStartCityResponse;
import com.yxhl.protobuf.YxScheduleRequest;
import com.yxhl.protobuf.YxScheduleResponse;
import com.yxhl.zoume.data.http.rest.param.CheckUpdateParam;
import com.yxhl.zoume.data.http.rest.param.appraisal.AppraisalLabelParam;
import com.yxhl.zoume.data.http.rest.param.appraisal.AppraisalParam;
import com.yxhl.zoume.data.http.rest.param.appraisal.AppraisalResultParam;
import com.yxhl.zoume.data.http.rest.param.base.BaseRequestParam;
import com.yxhl.zoume.data.http.rest.param.busticket.PerfectCouponParam;
import com.yxhl.zoume.data.http.rest.param.coupon.CouponSelectParam;
import com.yxhl.zoume.data.http.rest.param.coupon.CurrentCouponParam;
import com.yxhl.zoume.data.http.rest.param.coupon.HistoryCouponParam;
import com.yxhl.zoume.data.http.rest.param.expresscar.ExpressCarBillDetailParam;
import com.yxhl.zoume.data.http.rest.param.expresscar.ExpressCarCancelOrderParam;
import com.yxhl.zoume.data.http.rest.param.feedback.FeedbackParam;
import com.yxhl.zoume.data.http.rest.param.identification.IdentificationParam;
import com.yxhl.zoume.data.http.rest.param.login.GetSmsCodeParam;
import com.yxhl.zoume.data.http.rest.param.login.MobileLoginParam;
import com.yxhl.zoume.data.http.rest.param.mywallet.TradeRecordDetailParam;
import com.yxhl.zoume.data.http.rest.param.mywallet.TradeRecordsParam;
import com.yxhl.zoume.data.http.rest.param.officialcar.CancelOfficialCarOrderParam;
import com.yxhl.zoume.data.http.rest.param.passenger.AddPassengerParam;
import com.yxhl.zoume.data.http.rest.param.passenger.GetPassengersParam;
import com.yxhl.zoume.data.http.rest.param.passenger.UpdatePassengerParam;
import com.yxhl.zoume.data.http.rest.param.pay.AliPaySignStrParam;
import com.yxhl.zoume.data.http.rest.param.pay.WXPayOrderParam;
import com.yxhl.zoume.data.http.rest.param.pay.WalletPayParam;
import com.yxhl.zoume.data.http.rest.param.specialcar.CancelOrderParam;
import com.yxhl.zoume.data.http.rest.param.specialcar.SpecialCarCashPayParam;
import com.yxhl.zoume.data.http.rest.param.specialcar.SpecialCarPayInfoParam;
import com.yxhl.zoume.data.http.rest.param.specialcar.SpecialCarPollingParam;
import com.yxhl.zoume.data.http.rest.param.specialcar.SpecialCarQueryParam;
import com.yxhl.zoume.data.http.rest.param.splash.SplashParam;
import com.yxhl.zoume.data.http.rest.param.tripsmgnt.BusRefundParam;
import com.yxhl.zoume.data.http.rest.param.tripsmgnt.CommentDriverParam;
import com.yxhl.zoume.data.http.rest.param.tripsmgnt.RefundTripParam;
import com.yxhl.zoume.data.http.rest.param.usercenter.LogoutParam;
import com.yxhl.zoume.data.http.rest.response.appraisal.AppraisalLabelResponse;
import com.yxhl.zoume.data.http.rest.response.appraisal.AppraisalResponse;
import com.yxhl.zoume.data.http.rest.response.appraisal.AppraisalResultResponse;
import com.yxhl.zoume.data.http.rest.response.coupon.CouponSelectResponse;
import com.yxhl.zoume.data.http.rest.response.coupon.CurrentCouponResponse;
import com.yxhl.zoume.data.http.rest.response.coupon.HistoryCouponResponse;
import com.yxhl.zoume.data.http.rest.response.coupon.PerfectCouponResponse;
import com.yxhl.zoume.data.http.rest.response.expresscar.ExpressCarBillDetailResponse;
import com.yxhl.zoume.data.http.rest.response.feedback.FeedbackResponse;
import com.yxhl.zoume.data.http.rest.response.identification.IdentificationResponse;
import com.yxhl.zoume.data.http.rest.response.login.CheckUpdateResponse;
import com.yxhl.zoume.data.http.rest.response.login.GetSmsCodeResponse;
import com.yxhl.zoume.data.http.rest.response.login.MobileLoginResponse;
import com.yxhl.zoume.data.http.rest.response.mywallet.TradeRecordDetailResponse;
import com.yxhl.zoume.data.http.rest.response.mywallet.TradeRecordsResponse;
import com.yxhl.zoume.data.http.rest.response.mywallet.WalletBalanceResponse;
import com.yxhl.zoume.data.http.rest.response.passenger.AddPassengerResponse;
import com.yxhl.zoume.data.http.rest.response.passenger.GetPassengersResponse;
import com.yxhl.zoume.data.http.rest.response.passenger.UpdatePassengerResponse;
import com.yxhl.zoume.data.http.rest.response.pay.ALiPaySignStrResponse;
import com.yxhl.zoume.data.http.rest.response.pay.WXPayOrderResponse;
import com.yxhl.zoume.data.http.rest.response.pay.WalletPayResponse;
import com.yxhl.zoume.data.http.rest.response.specialcar.CancelOrderResponse;
import com.yxhl.zoume.data.http.rest.response.specialcar.SpecialCarCashPayResponse;
import com.yxhl.zoume.data.http.rest.response.specialcar.SpecialCarPayInfoResponse;
import com.yxhl.zoume.data.http.rest.response.specialcar.SpecialCarPollingResponse;
import com.yxhl.zoume.data.http.rest.response.specialcar.SpecialCarPriceQueryResponse;
import com.yxhl.zoume.data.http.rest.response.splash.BannerResponse;
import com.yxhl.zoume.data.http.rest.response.splash.SplashResponse;
import com.yxhl.zoume.data.http.rest.response.tirps.CommentDriverResponse;
import com.yxhl.zoume.data.http.rest.response.tirps.RefundProgressResponse;
import com.yxhl.zoume.data.http.rest.response.tirps.RefundResponse;
import com.yxhl.zoume.data.http.rest.response.tirps.RefundTicketResponse;
import com.yxhl.zoume.data.http.rest.response.usercenter.LogoutResponse;

import okhttp3.ResponseBody;
import retrofit2.http.Body;
import retrofit2.http.GET;
import retrofit2.http.Headers;
import retrofit2.http.POST;
import retrofit2.http.Query;
import retrofit2.http.Streaming;
import retrofit2.http.Url;
import rx.Observable;

/**
 * RESTful API 描述
 * Created by Xboy on 16/2/25.
 */
public interface ZouMeService {

    String HEADER_CONTENT_TYPE = "Content-Type: application/x-protobuf";
    String HEADER_ACCEPT = "Accept: application/x-protobuf";
    String HEADER_JSON_TYPE = "Content-Type: application/json";


    //*****************************************支付
    //微信支付预订单生成
    @POST("order/getPrePayInfoForWechat")
    Observable<WXPayOrderResponse> wxPaypreOrder(@Body WXPayOrderParam param);

    /**
     * 获取支付宝支付签证字符串
     * author vhawk
     *
     * @param aliPaySignStrParam
     * @return
     */
    @POST("order/getSignForAli")
    Observable<ALiPaySignStrResponse> aliPaySignStr(@Body AliPaySignStrParam aliPaySignStrParam);


    //*****************************************登录
    //获取短信验证码
    @POST("user/sendsms")
    Observable<GetSmsCodeResponse> getSmsCode(@Body GetSmsCodeParam param);

    //用户登录
    @POST("user/login")
    Observable<MobileLoginResponse> loginByMobile(@Body MobileLoginParam param);


    //主页
    //客户端新版本检测
    @POST("version/check")
    Observable<CheckUpdateResponse> checkUpdate(@Body CheckUpdateParam param);

    //版本更新,下载App
    @Streaming
    @GET
    Observable<ResponseBody> downloadApp(@Url String fileUrl);


    //*****************************************巴士


    /**
     * 巴士售票中，获取出发城市数据
     * ethan
     *
     * @param param
     * @return
     */
    @Headers({
            HEADER_CONTENT_TYPE,
            HEADER_ACCEPT
    })
    @POST("pubTicket/getStartCity")
    Observable<PubStartCityResponse> getStartCities(@Body PubStartCityRequest param);

    /**
     * 巴士售票中，获取到达城市接口描述
     * author vhawk
     * modify sugarya
     *
     * @param param
     * @return
     */
    @Headers({
            HEADER_CONTENT_TYPE,
            HEADER_ACCEPT
    })
    @POST("pubTicket/getEndStation")
    Observable<PubEndStationResponse> getArrivalCities(@Body PubEndStationRequest param);

    // 巴士班次查询
    @Headers({
            HEADER_CONTENT_TYPE,
            HEADER_ACCEPT
    })
    @POST("pubTicket/getSchedule")
    Observable<YxScheduleResponse> getBusServices(@Body YxScheduleRequest param);


    // 巴士车票详情
    @Headers({
            HEADER_CONTENT_TYPE,
            HEADER_ACCEPT
    })
    @POST("pubTicket/queryOneYxBusInfo")
    Observable<OneYxBusInfoResponse> getBusTicketDetail(@Body OneYxBusInfoRequest param);

    // 定制巴士详情
    @Headers({
            HEADER_CONTENT_TYPE,
            HEADER_ACCEPT
    })
    @POST("YXBus/queryOneYxBusInfo")
    Observable<OneYxBusInfoResponse> getZouMeBusDetail(@Body OneYxBusInfoRequest param);

    // 判断是否需要接驳车
    @Headers({
            HEADER_CONTENT_TYPE,
            HEADER_ACCEPT
    })
    @POST("YXBus/needFerry")
    Observable<IsFerryResponse> checkIsNeedShuttle(@Body IsFerryRequest param);

    /**
     * 锁票
     * sugarya
     *
     * @param param
     * @return
     */
    @Headers({
            HEADER_CONTENT_TYPE,
            HEADER_ACCEPT
    })
    @POST("pubTicket/lockTickets")
    Observable<PubLockTicketResponse> lockTickets(@Body PubLockTicketRequest param);


    // 定制巴士确认支付
    @Headers({
            HEADER_CONTENT_TYPE,
            HEADER_ACCEPT
    })
    @POST("order/addOrderV2")
    Observable<BizOrderResponse> generateZouMeBusOrder(@Body BizOrderRequest param);

    // 固定时刻类巴士确认支付
    @Headers({
            HEADER_CONTENT_TYPE,
            HEADER_ACCEPT
    })
    @POST("order/addOrderV2")
    Observable<BizOrderResponse> generateSetTimeBusOrder(@Body BizOrderRequest param);


    //*****************************************用车


    //------------------快车
    //查询快车行程费用
    @POST("price/queryForCar")
    Observable<SpecialCarPriceQueryResponse> querySpecialCarPrice(@Body SpecialCarQueryParam param);

    //快车下单
    @Headers({
            HEADER_CONTENT_TYPE,
            HEADER_ACCEPT
    })
    @POST("order/addOrderV2")
    Observable<BizOrderResponse> getSpecialCarOrder(@Body BizOrderRequest bizOrderRequest);

    //查询未完成的快车订单
    @Headers({
            HEADER_CONTENT_TYPE,
            HEADER_ACCEPT
    })
    @POST("order/queryLastUnFinishOrderForCarV2")
    Observable<BizOrderResponse> queryLastUnFinishOrder(@Body BizOrderRequest param);


    //取消订单
    @POST("order/cancel")
    Observable<CancelOrderResponse> cancelOrder(@Body CancelOrderParam param);

    //快车地图轮询
    @POST("order/queryLoc")
    Observable<SpecialCarPollingResponse> querySpecialCarRollingResult(@Body SpecialCarPollingParam param);


    //----------------公务车

    //查询车辆类型/图片
    @Headers({
            HEADER_CONTENT_TYPE,
            HEADER_ACCEPT
    })
    @POST("order/queryVehicleModel")
    Observable<MpvModelResponse> queryVehicleModel(@Body MpvModelRequest request);

    //查询公务车下单所需距离和价格
    @Headers({
            HEADER_CONTENT_TYPE,
            HEADER_ACCEPT
    })
    @POST("order/getPriceDistance")
    Observable<MpvModelResponse> queryPriceAndDistance(@Body MpvModelRequest request);

    //查询分时租车服务提供的时间段
    @Headers({
            HEADER_CONTENT_TYPE,
            HEADER_ACCEPT
    })
    @POST("order/queryRentalTime")
    Observable<MpvModelResponse> queryRentCarTime(@Body MpvModelRequest request);


    //公务车/专车下单
    @Headers({
            HEADER_CONTENT_TYPE,
            HEADER_ACCEPT
    })
    @POST("order/addOrderV2")
    Observable<BizOrderResponse> createNewCarOrder(@Body BizOrderRequest request);


    //取消公务车订单
    @POST("order/cancel")
    Observable<CancelOrderResponse> cancelOfficialCarOrder(@Body CancelOfficialCarOrderParam param);


    //*****************************************行程

    //查询当前行程(protobuf方式)
    @Headers({
            HEADER_CONTENT_TYPE,
            HEADER_ACCEPT
    })
    @POST("order/queryByPageV2")
    Observable<BizOrderResponse> getCurrentTripOrders(@Body BizOrderRequest param);

    //查询历史行程(protobuf方式)
    @Headers({
            HEADER_CONTENT_TYPE,
            HEADER_ACCEPT
    })
    @POST("order/queryByPageV2")
    Observable<BizOrderResponse> getHistoryTripOrders(@Body BizOrderRequest param);


    //行程里的评论司机
    @POST("judge/add")
    Observable<CommentDriverResponse> commentOnTripDriver(@Body CommentDriverParam param);

    //退票
    @POST("order/refund")
    Observable<RefundResponse> refundTicket(@Body RefundTripParam param);

    //查询行程订单详情
    @Headers({
            HEADER_CONTENT_TYPE,
            HEADER_ACCEPT
    })
    @POST("order/detailV2")
    Observable<BizOrderResponse> getDetailTripOrder(@Body BizOrderRequest param);

    /**
     * 查询定制巴士车票
     * author vhawk
     *
     * @param param
     * @return
     */
    @Headers({
            HEADER_CONTENT_TYPE,
            HEADER_ACCEPT
    })
    @POST("YXBus/myTicket")
    Observable<BizOrderResponse> getZouMeBusTicketList(@Body BizOrderRequest param);


    //*****************************************我的
    // 查询常用乘客
    @POST("contract/queryByPage")
    Observable<GetPassengersResponse> getAddedPassengers(@Body GetPassengersParam param);

    // 添加新乘客
    @POST("contract/add")
    Observable<AddPassengerResponse> addNewPassenger(@Body AddPassengerParam param);

    // 更新乘客信息
    @POST("contract/update")
    Observable<UpdatePassengerResponse> updatePassenger(@Body UpdatePassengerParam param);

    /**
     * 退出登录接口
     * author vhawk
     *
     * @param logoutParam
     * @return
     */
    @POST("user/logout")
    Observable<LogoutResponse> logout(@Body LogoutParam logoutParam);

    /**
     * 4期司机评论
     *
     * @param param
     * @return
     */
    @POST("judge/add")
    Observable<AppraisalResponse> appraiseDriver(@Body AppraisalParam param);

    /**
     * 获取评价标签
     *
     * @param param
     * @return
     */
    @POST("judge/queryAllLabel")
    Observable<AppraisalLabelResponse> fetchAppraisalLabel(@Body AppraisalLabelParam param);

    /**
     * 查看对司机的评价结果
     *
     * @param param
     * @return
     */
    @POST("user/queryAuth")
    Observable<IdentificationResponse> queryIdentificationStatus(@Body IdentificationParam param);

    /**
     * 提交实名认证查询
     *
     * @param param
     * @return
     */
    @POST("user/auth")
    Observable<IdentificationResponse> postIdentificationStatus(@Body IdentificationParam param);

    /**
     * 查看评价结果
     *
     * @param param
     * @return
     */
    @POST("judge/query")
    Observable<AppraisalResultResponse> fetchAppraisalResult(@Body AppraisalResultParam param);


    /**
     * 快车现金支付
     *
     * @param param
     * @return
     */
    @POST("order/cashPay")
    Observable<SpecialCarCashPayResponse> specialCarPayByCash(@Body SpecialCarCashPayParam param);

    /**
     * splash 启动页
     *
     * @param param
     * @return
     */
    @Headers({
            HEADER_JSON_TYPE
    })
    @POST("image/splash")
    Observable<SplashResponse> obtainSplash(@Body SplashParam param);

    /**
     * splash 启动页
     *
     * @param
     * @return
     */
    @GET("image/splash")
    Observable<SplashResponse> obtainSplash(
            @Query("clientSystem") String clientSystem,
            @Query("screen") String screen
    );

    /**
     * 获取当前优惠券
     *
     * @param param
     * @return
     */
    @POST("coupon/userQueryCenter")
    Observable<CurrentCouponResponse> fetchCurrentCoupons(@Body CurrentCouponParam param);

    /**
     * 获取历史优惠券
     *
     * @param param
     * @return
     */
    @POST("coupon/userQueryCenter")
    Observable<HistoryCouponResponse> fetchHistoryCoupons(@Body HistoryCouponParam param);

    /**
     * 获取可用优惠券
     *
     * @param param
     * @return
     */
    @POST("coupon/queryUserCouponByBizType")
    Observable<CouponSelectResponse> fetchUsefulCoupons(@Body CouponSelectParam param);

    /**
     * 获取快车订单详情
     *
     * @param param
     * @return
     */
    @POST("coupon/queryPerfectCoupon")
    Observable<SpecialCarPayInfoResponse> fetchSpecialCarPayInfo(@Body SpecialCarPayInfoParam param);

    /**
     * 查询最佳优惠券
     *
     * @param param
     * @return
     */
    @POST("coupon/queryPerfectCoupon")
    Observable<PerfectCouponResponse> queryPerfectCoupon(@Body PerfectCouponParam param);

    /**
     * 查询交易记录
     *
     * @param param
     * @return
     */
    @POST("wallet/queryTradeRecords")
    Observable<TradeRecordsResponse> queryTradeRecords(@Body TradeRecordsParam param);

    /**
     * 钱包支付
     *
     * @param payParam
     * @return
     */
    @POST("order/zmPay")
    Observable<WalletPayResponse> payByWallet(@Body WalletPayParam payParam);

    /**
     * 查询交易详情
     *
     * @param param
     * @return
     */
    @POST("wallet/queryTradeDetail")
    Observable<TradeRecordDetailResponse> queryTradeRecordDetail(@Body TradeRecordDetailParam param);

    /**
     * 查询钱包余额
     *
     * @param param
     * @return
     */
    @POST("wallet/getWalletBalance")
    Observable<WalletBalanceResponse> queryWalletBalance(@Body BaseRequestParam param);

    /**
     * 意见反馈
     *
     * @param param
     * @return
     */
    @POST("advice/add")
    Observable<FeedbackResponse> commitFeedback(@Body FeedbackParam param);

    /**
     * banner
     *
     * @return
     */
    @GET("image/banner")
    Observable<BannerResponse> obtainBanner();

    /*----------------------------------专车---------------------------------------*/
    //取消专车订单
    @POST("order/cancel")
    Observable<CancelOrderResponse> cancelExpressCarOrder(@Body ExpressCarCancelOrderParam param);

    @POST("order/valuationRules")
    Observable<MpvModelResponse> queryPricingRules(@Body MpvModelRequest request);

    /**
     * @param param
     * @return
     */
    @POST("order/billDetail")
    Observable<ExpressCarBillDetailResponse> fetchExpressBillDetail(@Body ExpressCarBillDetailParam param);


    /**
     * 提交bus退票
     * @param param
     * @return
     */
    @POST("YYTicket/applyBackTicket")
    Observable<RefundTicketResponse> applyBusRefundTicket(@Body BusRefundParam param);

    /**
     * 确认bus退票
     * @param param
     * @return
     */
    @POST("YYTicket/confirmBackTicket")
    Observable<RefundTicketResponse> confirmBusRefundTicket(@Body BusRefundParam param);


    /**
     * 查询bus退票处理进度
     * @param param
     * @return
     */
    @POST("YYTicket/refunedProgress")
    Observable<RefundProgressResponse> queryRefundTicketProgress(@Body BusRefundParam param);
}
